package com.wd.tech.mvp;

import android.util.Log;

import com.wd.tech.contract.IContract;
import com.wd.tech.utils.NetUtil;

import java.util.HashMap;
import java.util.Map;

import okhttp3.RequestBody;

/**
 * 时间：2020/7/1
 * 作者：徐黎明
 * 类的作用：
 */
public class IModelImpl implements IContract.IModel {
    //注册
    @Override
    public void IModelRegisterInfo(String url, Map<String, Object> map, Class cls, IContract.ModelCallBack CallBack) {
        NetUtil.getInstance().GetregisterInfo(url, map, cls, new NetUtil.NetCallBack() {
            @Override
            public void success(Object o) {
                if (CallBack!=null){
                    CallBack.success(o);
                }
            }

            @Override
            public void Error(String error) {

            }
        });
    }

    @Override
    public void IModelCommunityInfo(String url, Map<String, Object> map, Class cls, IContract.ModelCallBack CallBack) {
        NetUtil.getInstance().GetcommunityInfo(url,map ,cls, new NetUtil.NetCallBack() {
            @Override
            public void success(Object o) {
                if (CallBack!=null){
                    CallBack.success(o);
                }
            }

            @Override
            public void Error(String error) {

            }
        });
    }

    //点赞
    @Override
    public void IModelAddCommunity(String url, Map<String, Object> map, Class cls, IContract.ModelCallBack CallBack) {
        NetUtil.getInstance().AddCommunity(url,map,  cls, new NetUtil.NetCallBack() {
            @Override
            public void success(Object o) {
                if (CallBack!=null){
                    CallBack.success(o);
                }
            }

            @Override
            public void Error(String error) {

            }
        });
    }

    //取消点赞
    @Override
    public void IModelCancleAdd(String url, Map<String, Object> map, Class cls, IContract.ModelCallBack CallBack) {
//        NetUtil.getInstance().CancelAdd(url,map, cls, new NetUtil.NetCallBack() {
//            @Override
//            public void success(Object o) {
//                if (CallBack!=null){
//                    CallBack.success(o);
//                }
//            }
//
//            @Override
//            public void Error(String error) {
//
//            }
//        });
    }

    //发布帖子
    @Override
    public void IModelReleasePost(String url, Map<String, RequestBody> map, Class cls, IContract.ModelCallBack CallBack) {
        NetUtil.getInstance().ReleasePost(url, map, cls, new NetUtil.NetCallBack() {
            @Override
            public void success(Object o) {
                if (CallBack!=null){
                    CallBack.success(o);
                }
            }

            @Override
            public void Error(String error) {

            }
        });
    }

    @Override
    public void IModelReleasePost(String url, HashMap<String, RequestBody> map, Class cls, IContract.ModelCallBack CallBack) {
        NetUtil.getInstance().ReleasePost(url, map, cls, new NetUtil.NetCallBack() {
            @Override
            public void success(Object o) {
                CallBack.success(o);
            }

            @Override
            public void Error(String error) {

            }
        });
    }

    //Xbanner
    @Override
    public void ModelGetXBannerInfo(String url, Class cls, IContract.ModelCallBack callBack) {
        NetUtil.getInstance().GetXBannerInfo(url, cls, new NetUtil.NetCallBack() {
            @Override
            public void success(Object o) {
                callBack.success(o);
            }

            @Override
            public void Error(String error) {

            }

        });
    }
    //展示资讯首页
    @Override
    public void ModelGetNewsShow(String url, Map<String, Object> map, Class cls, IContract.ModelCallBack callBack) {

        NetUtil.getInstance().GetNewsShow(url, cls, map, new NetUtil.NetCallBack() {
            @Override
            public void success(Object o) {
                callBack.success(o);
            }

            @Override
            public void Error(String error) {

            }
        });

    }
    //兴趣频道
    @Override
    public void ModelGetChannel(String url, Class cls, IContract.ModelCallBack callBack) {

        NetUtil.getInstance().GetChannel(url, cls, new NetUtil.NetCallBack() {
            @Override
            public void success(Object o) {
                callBack.success(o);
            }

            @Override
            public void Error(String error) {

            }
        });

    }
    //频道详情
    @Override
    public void ModelGetNewsChanner(String url, Map<String, Object> map, Class cls, IContract.ModelCallBack callBack) {

        NetUtil.getInstance().GetNewsChanner(url, cls, map, new NetUtil.NetCallBack() {
            @Override
            public void success(Object o) {
                callBack.success(o);
            }

            @Override
            public void Error(String error) {

            }
        });

    }

}
